package com.wbc.smartHome.dao;

import com.wbc.smartHome.model.CommunityActivitiesLabel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CommunityActivitiesLabelDao {

    List<CommunityActivitiesLabel> getCommunityActivitiesLabelList(CommunityActivitiesLabel communityActivitiesLabel);

    @Insert("insert into communityactivities_label(name,oper_time,adminid)values (#{name},now(),#{adminid})")
    void setCommunityActivitiesLabel(String name,int adminid);

    @Select("select id,name from communityactivities_label where id in (select labelid from communityactivitieslabel_communityactivities where activitiesid = #{id})")
    List<CommunityActivitiesLabel> getCommunityActivitiesLabelByActivitiesId(Integer id);

    @Delete("delete from communityactivities_label where id = #{id}")
    void delete(int id);

    @Update("update communityactivities_label set name = #{name},adminid=#{adminId},oper_time = now() where id =#{id}")
    void updateCommunityActivitiesLabel(Integer id, String name, int adminId);

    @Select("select id,name from communityactivities_label where id = #{id}")
    CommunityActivitiesLabel getCommunityActivitiesLabelById(int id);

}
